<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="dj.pageModel.PcompanyReport" %>
<script type="text/javascript">
	function getBackCompanyReport(id) {
		if (id) {
			$('<div/>').dialog({
				href : "${pageContext.request.contextPath}/companyReportAction!toReportPage.action?id=" + id,
				width : 800,
				height : 670,
				modal : true,
				title : '报表信息',
				buttons : [ {
					text : '取回',
					iconCls : 'icon-save',
					handler : function() {
						var d = $(this).closest('.window-body');
						$.ajax({
							type : "POST",
							url : "${pageContext.request.contextPath}/companyReportAction!changeReportStatus.action",
							dataType : "json",
							data : "status=<%=PcompanyReport.STRUTS_未提交 %>&id=" + id,
							error : function(info) {
								$.messager.progress('close');
								eval(info.responseText);
							},
							success : function(result) {
								$.messager.show({
									msg : result.msg,
									title : '提示'
								});
								$.messager.progress('close');
								if (result.success) {
									$('#company-datareport-wait-audit-list-dg').datagrid('reload');
									d.dialog('destroy');
								}
							}
						});
					}
				} ],
				onLoad : function() {
					var objs = document.getElementById("company-datareport-report-form");
					if(objs) {
						for(i = 0; i < objs.elements.length; i++) {
							objs[i].disabled = true; 
						}
					}
				},
				onClose : function() {
					$(this).dialog('destroy');
				}
			});
		} else {
			$.messager.alert('提示', '没有可取回的对象！');
		}
	}

	//查询功能
	function searchReportWaitAudit() {
		$("#company-datareport-wait-audit-list-dg").datagrid("options").queryParams = getQueryParams("company-datareport-wait-audit-search");
		autoLoad($("#company-datareport-wait-audit-list-dg").datagrid("getPager"), 1);
	}

	$(function() {
		$('#company-datareport-wait-audit-list-dg').datagrid({
			url : "${pageContext.request.contextPath }/companyReportAction!getCompanyReportListByCompany.action",
			queryParams : {
				status : "<%=PcompanyReport.STRUTS_未审核%>"
			},
			onLoadError : function(retValue) {
				eval(retValue.responseText);
			},
			singleSelect : true,
			selectOnCheck : true,
			pagination : true,
			fitColumns : true,
			pageSize : 10,
			pageList : [ 5, 10, 15, 20 ],
			nowrap : true,
			border : false,
			singleSelect : false,
			idField : 'id',
			frozenColumns : [ [ {
				field : 'id',
				width : 50,
				checkbox : true
			} ] ],
			columns : [ [ {
				field : 'taskmonth',
				title : '月份',
				width : 100
			}, {
				field : 'startDate',
				title : '开始日期',
				width : 120
			}, {
				field : 'endDate',
				title : '结束日期',
				width : 120
			}, {
				field : 'operate',
				title : '操作',
				width : 80,
				align : 'center',
				formatter : function(value, rowData, rowIndex) {
					return "<a href='javascript:void(0)' onclick='getBackCompanyReport(\"" + rowData.id + "\");'><img src='${pageContext.request.contextPath }/images/pencil.png' oncl border='0'></a>";
				}
			} ] ]
		});
	});
</script>
<div class="easyui-layout" data-options="fit:true">

	<div data-options="region:'north', title:'查询', iconCls: 'icon-search'" style="height:80px; padding: 0;">
		<div style="padding-top: 10px; padding-left: 20px">
			<form id="company-datareport-wait-audit-search">
				<span>月份：<input type="text" id="company-datareport-wait-audit-month" name="taskmonth" onclick="WdatePicker({dateFmt:'yyyy-MM', minDate:'%y-%M'})"></span>&nbsp;&nbsp;
				<span><a href="javascript:void(0)" class="easyui-linkbutton" onclick="searchReportWaitAudit()" data-options="iconCls:'icon-search'">查询</a></span>
			</form>
		</div>
	</div>

	<div data-options="region:'center', title:'数据录入列表', iconCls: 'icon-group'" style="padding: 0;">
		<table id="company-datareport-wait-audit-list-dg"></table>
	</div>

</div>
